package org.example.feign;

import org.example.dto.StudentInfoDTO;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class StudenServiceFallback implements FallbackFactory<StudenService> {
    @Override
    public StudenService create(Throwable cause) {
        return new StudenService() {
            @Override
            public StudentInfoDTO select(StudentInfoDTO studentInfoDTO) {
                return StudentInfoDTO.builder()
                        .examNumber("FALLBACK-" + studentInfoDTO.getExamNumber())
                        .lasName("通知失败: " + cause.getMessage())
                        .build();
            }
        };
    }
}
